//Copyright (c) 2002, Art Gittleman
//This example is provided WITHOUT ANY WARRANTY 
//either expressed or implied.

/* Displays the resource specified by the URI 
 * entered on the command line.
 */

using System;
using System.IO;
using System.Net;
public class TryURL {
  public static void Main(String [] args) {
    WebClient client = new WebClient();
    client.Headers.Add("Accept","text/plain");
    client.BaseAddress = args[0];
    client.DownloadFile(args[1], args[2]);
    StreamReader input = 
             new StreamReader(client.OpenRead(args[1]));
    Console.WriteLine(input.ReadToEnd());
    Console.WriteLine(client.Headers.Count);
    WebHeaderCollection header = client.ResponseHeaders;
    for (int i = 0; i < header.Count; i++)
      Console.WriteLine("{0} : {1}", header.GetKey(i), header[i]);
    input.Close();
  }
}  
        
    